<%-- 
    Document   : addChatterToRoom
    Created on : Apr 14, 2011, 11:21:02 AM
    Author     : Revolutors Styx
--%>

<%@page language="java" import="chat.*" contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <%
        ChatRoomList roomList = (ChatRoomList)application.getAttribute("roomList");
        /*
        *get the room selected
        */
        int chatRoomNumber;
        Chatter desiredChatterToAdd;
        /*get room number from user session*/
        chatRoomNumber = Integer.parseInt(request.getParameter("roomId"));
        //new generated chatter, get chatter data from user data desired to add to chat room
        desiredChatterToAdd = new Chatter(request.getParameter("name"), "male", 0);
        ChatRoom room = roomList.getRoomOfId(chatRoomNumber);
        /*
        Add New Chatter to Room
        */
        room.addChatter(desiredChatterToAdd);
        roomList.setRoom(chatRoomNumber, room);
        application.setAttribute("roomList", roomList);
        %>
    </body>
</html>
